#include <sys/msg.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include "QServerInit.h"

//See QCommon/QCommon.h
void Engine::init_out_msq()
{
	int msqid;
	if((msqid=msgget(IPC_PRIVATE,IPC_CREAT|IPC_EXCL|0666))==-1)
	{
		perror("The Message Queue has existed!\n");
	}
	store_msqid(msqid);
}

//The FIFO used by QClients
//If the QClient start, send some infomation to the FIFO and the
//QServer can serve for it.
void Engine::init_FIFO()
{
	int fifo;
	remove(Q_CS_FIFO);
	if((fifo=mkfifo(Q_CS_FIFO,0666))==-1)
	{
		perror("Error: Cann't create the Q_CS_FIFO!\n");
		abort();
	}
}
